# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=pipr
pkgver=0.0.16
pkgrel=1
pkgdesc="A tool to interactively write shell pipelines"
url="https://github.com/elkowar/pipr"
# s390x: fails to build crossterm crate
# riscv64: cannot find type 'c_long' in the crate libc
arch="all !s390x !riscv64"
license="MIT"
depends="bubblewrap"
makedepends="
	cargo
	cargo-auditable
	oniguruma-dev
	"
source="https://github.com/elkowar/pipr/archive/v$pkgver/pipr-$pkgver.tar.gz
	handle-unrecognized-option.patch
	"

export RUSTONIG_DYNAMIC_LIBONIG=1  # use system libonig

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/pipr -t "$pkgdir"/usr/bin/
}

sha512sums="
51adcc3c37e5a86aa75d6368aeb8e675f4971cdebea41ef88ed5876ccd3165e14e5aa1ab5b4ceae09465ed2822b273ad6b9fc9716a8962b8d8f7b2819dacd9c1  pipr-0.0.16.tar.gz
9024cdfb41f161550dda9cb5460d93d606844ada008f11d94e80309ef5f9129870c21b0f24202435e7574a16ca24420ae01c9dacf7d63ab346de288db71451d0  handle-unrecognized-option.patch
"
